Typically, a cache is a special purpose high speed buffer interposed between a processor and a larger but slower speed data memory or data storage device. If data is stored in the cache, then it can be accessed (termed a "hit") in a shorter amount of time by the central processing unit (CPU) than if it were stored in the larger but slower data storage device. If data is not in the cache memory when referenced (termed a "miss"), then access must be made to the slower speed memory or storage device. When this occurs, the cache management software selects that portion of the cache memory containing stale data that has not been requested in a relatively long period of time and replaces it with the data just accessed from the slower data storage device.
Sophisticated cache memory schemes typically select and store data in the cache in anticipation of future use by the CPU to minimize the number of slow accesses to the slower data storage devices. As a result of the combination of the cache memory's speed, size and caching scheme, over 85% of the data requests may be performed with zero wait times. A typical cache memory has its own memory controller. When the CPU sends out a request for data, the cache memory controller intercepts it and checks the cache memory to see if the information is there so that it can be immediately accessed (a "hit"). If the information is not there (a "miss"), the cache memory controller reads the data from the slower system memory. The information is then copied into cache memory as it is sent to the processor so that all subsequent requests for that information can be read from cache memory, with zero wait times.
The advantage of caching arises from the tendency of applications to make repeated references to the same data. This clustering of data is commonly termed "locality of referencing". Performance measures include the ratio of the number of hits or misses to the total number of input/output (I/O) references. These are denominated the "hit ratio" or "miss ratio", respectively. In the past (the 1970's), hit and miss ratios were only determined from reference tables, which limited their utility to static tuning of storage devices.
In microcomputers, caches are used in two places. First, CPU chips contain separate data and instruction caches within them that lies between the CPU itself and the dynamic memory external to the chip. This creates an apparent speed up of the physical memory. Second, caching schemes are used between the microcomputer and its external mass storage devices, especially disk drives. This creates an apparent speed up of the external mass storage device. These cache schemes are referred to as "disk caches".
For example, there are many types of disk caching schemes implemented for the real mode Disk Operating System (DOS) environment. In addition, such a cache is implemented in the protected mode environment of Windows.RTM. 3.11, using memory under the control of Windows.RTM., and consists of several components, including separate cache logic and I/O logic. The memory manager component of the Microsoft Window.RTM. operating system, version 3.1x, is incorporated into the Virtual Machine Manager (VMM) virtual device. The VMM virtual device is responsible for managing the physical memory resources (i.e., RAM) of the computer system, which comprises all available physical memory at the time the Windows.RTM. program is started. Some of this physical memory can be devoted to implementing a cache system.
The cache logic component of the Windows.RTM. 3.11 operating system is VCache. VCache provides general storage and retrieval caching services to virtual device software components. A fixed proportion of the microcomputer physical memory is allocated by VCache from the VMM for caching during the duration of a Windows.RTM. session. A primary VCache client is the File Allocation Table (FAT) file system virtual device introduced with Windows.RTM. 3.11. VCache services are also available to other system or third party virtual device components.
Since the effectiveness of a caching scheme is directly related to the amount of memory it has been assigned, it is beneficial to devote as much physical memory for caching as possible. However, it is not effective to increase the cache memory size at the expense of committed virtual memory devoted to the operating system and user applications, because doing so can cause a substantial increase in virtual memory paging to the swap file that resides on disk. When virtual memory paging occurs, there is more disk access activity and therefore the system slows down.
The performance penalty incurred by a dramatic increase in paging outweighs the slight gains realized by the extra cache memory. Therefore, a fixed size cache, such as implemented by VCache, requires the user to weigh the penalties against the benefits to determine a fixed size of the disk cache before starting the operating system. This cache size will remain fixed during the entire session. Therefore, it is an object of the invention to allow the cache size to be dynamically determined while the operating system is running so that the cache management software component can automatically maintain as large a cache as possible without incurring the increased paging penalty.